const app = getApp();

Component({
  /**
   * 组件的属性列表
   */
  properties: {
    title: {
      type: String,
      value: 'title'
    },
    placeholder: {
      type: String,
      value: '搜索内容'
    },
    showback: {
      type: Boolean,
      value: false
    },
    showsearch: {
      type: Boolean,
      value: false
    },
    showtitle: {
      type: Boolean,
      value: false
    },
    takespace: {
      type: Boolean,
      value: true
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    key: '',
    defaultText: "创新创业教育",
    statusBarHeight: app.globalData.statusBarHeight,
    navbarHeight: app.globalData.navbarHeight
  },

  /**
   * 组件的方法列表
   */
  methods: {
    clickBack: function () {
      wx.navigateBack();
    },

    clickSearch: function () {
      wx.showToast({
        title: '点击搜索'
      });
    },

    go: function (arg) {
      console.log('search gp', arg);
      var key = arg.detail.value;
      if(key == '') return;
      this.setData({
        key: ''
      });
      wx.navigateTo({
        url: '../../pages/searchResult/searchResult?key=' + key
      });
    }
  }
})